package io.jpress.service.provider;

import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import io.jboot.aop.annotation.Bean;
import io.jboot.service.JbootServiceBase;
import io.jpress.model.BusinessProcess;
import io.jpress.service.BusinessProcessService;

import java.util.List;

@Bean
public class BusinessProcessServiceProvider extends JbootServiceBase<BusinessProcess> implements BusinessProcessService {

    @Override
    public Object save(BusinessProcess model){
        Object id = super.save(model);
        return id;
    }
    @Override
    public boolean checkObject(long id) {
        boolean flag;
        List<Record> records = Db.find("select * from business_process where id = ?", id);

            if (records == null || records.isEmpty()) {
                flag = false;
            }else {
                flag = true;
            }

        return flag;
    }

}